﻿using System;
using System.Windows.Forms;
using EvidenceManagement.ViewModel.Security;
using EvidenceManagement.ViewModel.Common;

namespace EvidenceManagement.Workstation.Security
{
    public partial class frmRegisterUser : Form, IRegisterUserView
    {
        #region Fields

        readonly IMasterView masterView = null;
        #endregion

        public frmRegisterUser()
        {
            InitializeComponent();
        }

        public frmRegisterUser(IMasterView masterView)
            :this()
        {
            this.masterView = masterView;
        }

        private void btnNext_Click(object sender, EventArgs e)
        {

        }

        private void btnBack_Click(object sender, EventArgs e)
        {

        }

        private void btnCancel_Click(object sender, EventArgs e)
        {

        }

        #region IRegisterUserView Members

        public string EmployeeNumber
        {
            get
            {
                return txtEmployeeNumber.Text.Trim();
            }
            set
            {
                txtEmployeeNumber.Text = value;
            }
        }

        public Guid TitleID
        {
            get
            {
                if (cmbTitle.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbTitle.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbTitle.Items.Count > 0)
                    cmbTitle.SelectedValue = value;
            }
        }

        public string FirstName
        {
            get
            {
                return txtFirstName.Text.Trim();
            }
            set
            {
                txtFirstName.Text = value;
            }
        }

        public string MiddleName
        {
            get
            {
                return txtMiddleName.Text.Trim();
            }
            set
            {
                txtMiddleName.Text = value;
            }
        }

        public string Surname
        {
            get
            {
                return txtSurname.Text.Trim();
            }
            set
            {
                txtSurname.Text = value;
            }
        }

        public Guid GenderID
        {
            get
            {
                if (cmbGender.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbGender.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbGender.Items.Count > 0)
                    cmbGender.SelectedValue = value;
            }
        }

        public Guid IdentityTypeID
        {
            get
            {
                if (cmbIdentityType.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbIdentityType.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbIdentityType.Items.Count > 0)
                    cmbIdentityType.SelectedValue = value;
            }
        }

        public string IdentityNumber
        {
            get
            {
                return txtIdentityNumber.Text.Trim();
            }
            set
            {
                txtIdentityNumber.Text = value;
            }
        }

        public DateTime DateOfBirth
        {
            get
            {
                return dtpDateOfBirth.Value;
            }
            set
            {
                dtpDateOfBirth.Value = value;
            }
        }

        public int Age
        {
            get
            {
                int age = 0;
                int.TryParse(txtAge.Text.Trim(), out age);
                return age;
            }
            set
            {
                txtAge.Text = value.ToString();
            }
        }

        public string EmailAddress
        {
            get
            {
                return txtEmailAddress.Text.Trim();
            }
            set
            {
                txtEmailAddress.Text = value;
            }
        }

        public string MobileNumber
        {
            get
            {
                return txtMobileNumber.Text.Trim();
            }
            set
            {
                txtMobileNumber.Text = value;
            }
        }

        public string HomeNumber
        {
            get
            {
                return txtHomeNumber.Text.Trim();
            }
            set
            {
                txtHomeNumber.Text = value;
            }
        }

        public string FaxNumber
        {
            get
            {
                return txtFaxNumber.Text.Trim();
            }
            set
            {
                txtFaxNumber.Text = value;
            }
        }

        public string PostalAddressLine1
        {
            get
            {
                return txtPostalLine1.Text.Trim();
            }
            set
            {
                txtPostalLine1.Text = value;
            }
        }

        public string PostalAddressLine2
        {
            get
            {
                return txtPostalLine2.Text.Trim();
            }
            set
            {
                txtPostalLine2.Text = value;
            }
        }

        public string PostalSuburb
        {
            get
            {
                return txtPostalSuburb.Text.Trim();
            }
            set
            {
                txtPostalSuburb.Text = value;
            }
        }

        public string PostalCode
        {
            get
            {
                return txtPostalCode.Text.Trim();
            }
            set
            {
                txtPostalCode.Text = value;
            }
        }

        public Guid PostalCountry
        {
            get
            {
                if (cmbPostalCountry.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbPostalCountry.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbPostalCountry.Items.Count > 0)
                    cmbPostalCountry.SelectedValue = value;
            }
        }

        public Guid PostalProvince
        {
            get
            {
                if (cmbPostalProvince.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbPostalProvince.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbPostalProvince.Items.Count > 0)
                    cmbPostalProvince.SelectedValue = value;
            }
        }

        public string PhysicalAddressLine1
        {
            get
            {
                return txtPhysicalLine1.Text.Trim();
            }
            set
            {
                txtPhysicalLine1.Text = value;
            }
        }

        public string PhysicalAddressLine2
        {
            get
            {
                return txtPhysicalLine2.Text.Trim();
            }
            set
            {
                txtPhysicalLine2.Text = value;
            }
        }

        public string PhysicalSuburb
        {
            get
            {
                return txtPhysicalSuburb.Text.Trim();
            }
            set
            {
                txtPhysicalSuburb.Text = value;
            }
        }

        public string PhysicalCode
        {
            get
            {
                return txtPhysicalCode.Text.Trim();
            }
            set
            {
                txtPhysicalCode.Text = value;
            }
        }

        public Guid PhysicalCountry
        {
            get
            {
                if (cmbPhysicalCountry.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbPhysicalCountry.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbPhysicalCountry.Items.Count > 0)
                    cmbPhysicalCountry.SelectedValue = value;
            }
        }

        public Guid PhysicalProvince
        {
            get
            {
                if (cmbPhysicalProvince.Items.Count > 0)
                    return new Guid(Convert.ToString(cmbPhysicalProvince.SelectedValue));
                else
                    return new Guid();
            }
            set
            {
                if (cmbPhysicalProvince.Items.Count > 0)
                    cmbPhysicalProvince.SelectedValue = value;
            }
        }

        public bool PostalSimilarToPhysical
        {
            get
            {
                return chkSameAddress.Checked;
            }
            set
            {
                chkSameAddress.Checked = value;
            }
        }

        public string UserName
        {
            get
            {
                return txtUserName.Text.Trim();
            }
            set
            {
                txtUserName.Text = value;
            }
        }

        public DateTime ActivationDate
        {
            get
            {
                return dtpActiveDate.Value;
            }
            set
            {
                dtpActiveDate.Value = value;
            }
        }

        public void GoToNextStep()
        {
            throw new NotImplementedException();
        }

        public void GoToPreviousStep()
        {
            throw new NotImplementedException();
        }

        public void CompleteRegistration()
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IView Members

        public Guid CurrentSystemUserId
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public void ShowView()
        {
            this.Show();
        }

        public void AbortView(string abortReason)
        {            
            throw new NotImplementedException();
        }

        public void CloseView()
        {
            this.Close();
        }

        public IMasterView MasterView
        {
            get { return masterView; }
        }

        #endregion
    }
}
